class SRVetFieldMedic extends SRVeterancy
	abstract;

static function int GetPerkProgressInt( ClientPerkRepLink StatOther, out int FinalInt, byte CurLevel, byte ReqNum )
{
	switch( CurLevel )
	{
	case 0:
		FinalInt = 0;
		break;
	case 1:
		FinalInt = 10000; // 10K
		break;
	case 2:
		FinalInt = 30000; // 20K
		break;
	case 3:
		FinalInt = 60000; // 30K
		break;
	case 4:
		FinalInt = 100000; // 40K
		break;
	case 5:
		FinalInt = 165000; // 65K
		break;
	case 6:
		FinalInt = 300000; // 135K
		break;
	case 7:
		FinalInt = 450000; // 150K
		break;
	case 8:
		FinalInt = 665000; // 215K
		break;
	default:
		FinalInt = 1000000 * ( CurLevel - 8 );
	}
	return Min(StatOther.RDamageHealedStat,FinalInt);
}

static function float GetSyringeChargeRate(KFPlayerReplicationInfo KFPRI)
{
	if( KFPRI.ClientVeteranSkillLevel < 5 )
		return 2.2 + 0.20 * float(KFPRI.ClientVeteranSkillLevel);
	else if( KFPRI.ClientVeteranSkillLevel < 9 )
		return 2.40 + 0.15 * float(KFPRI.ClientVeteranSkillLevel);
	else
		return 4.00; // 300% faster syringe recharge
}

static function float GetHealPotency(KFPlayerReplicationInfo KFPRI)
{
	if ( KFPRI.ClientVeteranSkillLevel < 5 )
		return 1.50;
	else if ( KFPRI.ClientVeteranSkillLevel < 9 )
		return 1.50 + 0.05 * float(KFPRI.ClientVeteranSkillLevel);
	return 2.00;
}

static function float GetFireModeSpeed(SRPlayerReplicationInfo SRPRI, class<WeaponFire> FireClass)
{
	local float ret;
	
	ret = 0.00;
	
	if ( SRPRI.ClientVeteranSkillLevel > 3 )
	{
		if ( class<Bal_MP5MAltFire>(FireClass) != none || class<MP7AltFire>(FireClass) != none
		|| class<WMediShotAltFire>(FireClass) != none || class<M7A3MAltFire>(FireClass) != none
		|| class<OpticalDeagleMedicAltFire>(FireClass) != none || class<HKMP7LLIAltFire>(FireClass) != none
		|| class<USP45MLLIAltFire>(FireClass) != none || class<CombatDrugsAltFire>(FireClass) != none
		|| class<NewSyringeAltFire>(FireClass) != none || class<NewSyringeFire>(FireClass) != none )
		{
			ret += 0.05 + 0.05 * float(Min(9,SRPRI.ClientVeteranSkillLevel)-3);
		}
	}
	
	ret += 1.00;
	
	return ret;
}

static function float GetFireSpeedMod(KFPlayerReplicationInfo KFPRI, Weapon Other)
{
	local float ret;

	ret = 0.00;
	
	if ( NewSyringe(Other) != none && KFPRI.ClientVeteranSkillLevel > 3 )
	{
		ret += 0.05 + 0.05 * float(Min(9,KFPRI.ClientVeteranSkillLevel)-3);
	}
	
	ret += 1.00;

	return ret * Super.GetFireSpeedMod(KFPRI,Other);
}

static function float GetMovementSpeedModifier(KFPlayerReplicationInfo KFPRI, KFGameReplicationInfo KFGRI)
{
	if ( KFPRI.ClientVeteranSkillLevel < 1 )
		return 1.12;
	if ( KFPRI.ClientVeteranSkillLevel < 2 )
		return 1.14;
	if ( KFPRI.ClientVeteranSkillLevel < 3 )
		return 1.16;
	if ( KFPRI.ClientVeteranSkillLevel < 4 )
		return 1.18;
	if ( KFPRI.ClientVeteranSkillLevel < 5 )
		return 1.20;
	if ( KFPRI.ClientVeteranSkillLevel < 6 )
		return 1.24;
	if ( KFPRI.ClientVeteranSkillLevel < 7 )
		return 1.26;
	if ( KFPRI.ClientVeteranSkillLevel < 8 )
		return 1.28;
	if ( KFPRI.ClientVeteranSkillLevel > 7 ) //if level is 8 and higher, grants 30% extra movement speed
		return 1.30;
}

static function float GetMeleeMovementSpeedModifier(KFPlayerReplicationInfo KFPRI)
{
	return 0.02;
}

static function int ReduceDamage(KFPlayerReplicationInfo KFPRI, KFPawn Injured, KFMonster DamageTaker, int InDamage, class<DamageType> DmgType)
{
	if ( class<SirenScreamDamage>(DmgType) != none && KFPRI.ClientVeteranSkillLevel > 9 )
		return float(InDamage) * 0.70;

	if ( DmgType == class'DamTypeVomit' )
	{
		if ( KFPRI.ClientVeteranSkillLevel == 0 )
			return float(InDamage) * 0.50;
		else if ( KFPRI.ClientVeteranSkillLevel == 1 )
			return float(InDamage) * 0.40;
		else if ( KFPRI.ClientVeteranSkillLevel == 2 )
			return float(InDamage) * 0.30;
		else if ( KFPRI.ClientVeteranSkillLevel < 5 )
			return float(InDamage) * 0.25;
		else if ( KFPRI.ClientVeteranSkillLevel < 7 )
			return float(InDamage) * 0.20;
		else if ( KFPRI.ClientVeteranSkillLevel < 8 )
			return float(InDamage) * 0.12;
		else if ( KFPRI.ClientVeteranSkillLevel < 9 )
			return float(InDamage) * 0.08;
		else if ( KFPRI.ClientVeteranSkillLevel > 8 )
			return float(InDamage) * 0.05;
	}
	return Super.ReduceDamage(KFPRI,Injured,DamageTaker,InDamage,DmgType);
}

static function float GetMagCapacityMod(KFPlayerReplicationInfo KFPRI, KFWeapon Other)
{
	if ( M7A3MMedicGun(Other) != none || WMediShot(Other) != none || MP7MedicGun(Other) != none
		|| OpticalDeagleMedic(Other) != none || Bal_MP5MMedicGun(Other) != none || HKMP7LLI(Other) != none
		|| USP45MLLI(Other) != none )
		return ( 1.0 + (0.20 * FMin(KFPRI.ClientVeteranSkillLevel+2, 5.0)) ) * GetProperMagCapacity(Other); // 100% increase in Medic weapon ammo carry
	return GetProperMagCapacity(Other);
}

static function float GetAmmoPickupMod(KFPlayerReplicationInfo KFPRI, KFAmmunition Other)
{
	if ( Bal_MP5MAmmo(Other) != none || M7A3MAmmo(Other) != none || MP7Ammo(Other) != none
		|| OpticalDeagleMedicAmmo(Other) != none || WMediShotAmmo(Other) != none || HKMP7LLIAmmo(Other) != none
		|| USP45MLLIAmmo(Other) != none )
		return ( 1.0 + (0.20 * FMin(KFPRI.ClientVeteranSkillLevel+2, 5.0)) ) * GetProperAmmoPickupAmount(Other); // 100% increase in MP7 Medic weapon ammo carry
	return GetProperAmmoPickupAmount(Other);
}

static function float AddExtraAmmoFor(KFPlayerReplicationInfo KFPRI, Class<Ammunition> AmmoType)
{
	if ( AmmoType == class'FragAmmo' || AmmoType == class'Frag1Ammo' )
	{
		return ( 1.20 + 0.20 * float(Min(9,KFPRI.ClientVeteranSkillLevel)) ) * GetProperAmmoAmount(AmmoType); // 15 first aid kits
	}
	
	if ( AmmoType == class'CombatDrugsStimulatorAmmo' )
	{
		return ( 0.0 + 1.0 * float(Min(5,(KFPRI.ClientVeteranSkillLevel+1)/2)) ); // 5 stimulations
	}
	
	if ( AmmoType == class'CombatDrugsAnalgeticAmmo' )
	{
		return ( 1.0 + 0.5 * float(Min(4,KFPRI.ClientVeteranSkillLevel/2)) ); // 6 analgetics
	}
	
	if ( class<Bal_MP5MAmmo>(AmmoType) != none || class<M7A3MAmmo>(AmmoType) != none || class<MP7Ammo>(AmmoType) != none
		|| class<OpticalDeagleMedicAmmo>(AmmoType) != none || class<WMediShotAmmo>(AmmoType) != none
		|| class<HKMP7LLIAmmo>(AmmoType) != none || class<USP45MLLIAmmo>(AmmoType) != none )
	return ( 1.0 + (0.20 * FMin(KFPRI.ClientVeteranSkillLevel+2, 5.0)) ) * GetProperAmmoAmount(AmmoType);
	
	return GetProperAmmoAmount(AmmoType);
}

static function float GetCostScaling(KFPlayerReplicationInfo KFPRI, class<Pickup> Item)
{
		if ( Item == class'Vest' || Item == class'M7A3MPickup' || Item == class'WMediShotPickup' 
			|| Item == class'MP7Pickup' || Item == class'Bal_MP5MPickup'
			|| Item == class'OpticalDeagleMedicPickup' || Item == class'HKMP7LLIPickup'
			|| Item == class'USP45MLLIPickup' )
			return GetDefaultCostScaling(KFPRI.ClientVeteranSkillLevel) * GetProperCostScaling(Item);

	return GetProperCostScaling(Item);
}

static function float GetBodyArmorDamageModifier(KFPlayerReplicationInfo KFPRI)
{
	if ( KFPRI.ClientVeteranSkillLevel == 0 )
		return 1.0 / 2.0;
	if ( KFPRI.ClientVeteranSkillLevel == 1 )
		return 1.0 / 2.5;
	if ( KFPRI.ClientVeteranSkillLevel == 2 )
		return 1.0 / 3.0;
	if ( KFPRI.ClientVeteranSkillLevel == 3 )
		return 1.0 / 3.5;
	if ( KFPRI.ClientVeteranSkillLevel == 4 )
		return 1.0 / 4.0;
	if ( KFPRI.ClientVeteranSkillLevel == 5 )
		return 1.0 / 6.0;
	if ( KFPRI.ClientVeteranSkillLevel == 6 )
		return 1.0 / 8.0;
	if ( KFPRI.ClientVeteranSkillLevel == 7 )
		return 1.0 / 12.0;
	if ( KFPRI.ClientVeteranSkillLevel == 8 )
		return 1.0 / 16.0;
	if ( KFPRI.ClientVeteranSkillLevel > 8 )
		return 1.0 / 20.0;

	return 1.0;
}

static function int GetMaxArmor(KFPlayerReplicationInfo KFPRI)
{
	if ( KFPRI.ClientVeteranSkillLevel >= 10 )
		return 200;

	return Super.GetMaxArmor(KFPRI);
}

static function string GetPickupShopName(KFPlayerReplicationInfo KFPRI, Class<Pickup> PickupClass, optional int FireModeNum)
{
	if ( PickupClass == class'Frag1Pickup' )
		return "First Aid Kit";
	
	return Super.GetPickupShopName(KFPRI,PickupClass);
}

static function class<Grenade> GetNadeType(KFPlayerReplicationInfo KFPRI)
{
	return class'SupportHealNade';
}

// Give Extra Items as Default
static function AddDefaultInventory(KFPlayerReplicationInfo KFPRI, Pawn P)
{
	super.AddDefaultInventory(KFPRI,P);

	if ( KFPRI.ClientVeteranSkillLevel > 2 )
		P.ShieldStrength += 100;
	
	if ( SRPlayerReplicationInfo(KFPRI).bHasCombatDrugs )
	{
		KFHumanPawn(P).CreateInventoryVeterancy("ServerPerksV4C.CombatDrugs", GetCostScaling(KFPRI, class'CombatDrugsPickup'));
	}
		
	if ( SRPlayerReplicationInfo(KFPRI).bRespawned )
		return;
		
	if ( KFPRI.ClientVeteranSkillLevel > 2 && KFPRI.ClientVeteranSkillLevel < 9 )
		KFHumanPawn(P).CreateInventoryVeterancy("ServerPerksV4C.Bal_MP5MMedicGun", GetCostScaling(KFPRI, class'Bal_MP5MPickup'));
		
	if ( KFPRI.ClientVeteranSkillLevel > 5 )
		KFHumanPawn(P).CreateInventoryVeterancy("ServerPerksV4C.WMediShot", GetCostScaling(KFPRI, class'WMediShotPickup'));

	if ( KFPRI.ClientVeteranSkillLevel > 8 )
		KFHumanPawn(P).CreateInventoryVeterancy("ServerPerksV4C.M7A3MMedicGun", GetCostScaling(KFPRI, class'M7A3MPickup'));
	
	SRPlayerReplicationInfo(KFPRI).bRespawned = true;
}

static function bool IsPerkTarget(PlayerReplicationInfo PRI, class<Actor> TargetClass)
{
	if ( TargetClass == class'DKClot' || TargetClass == class'DKCrawler'
		|| TargetClass == class'DKShiver' )
	{
		return true;
	}

	return Super.IsPerkTarget(PRI,TargetClass);
}

defaultproperties
{
     CustomLevelInfo="%s faster Syringe recharge|75% more potent medical injections|75% less damage from Bloat Bile|%r faster movement speed|100% larger MP7M Medic Gun clip|75% better Body Armor|%d discount on Body Armor||%m discount on MP7M Medic Gun| Spawn with Body Armor and Medic Gun"
     PerkIndex=0
	 BronzeIcon=Texture'SunriseHUD.Icons.Perk_Medic_Bronze'
	 SilverIcon=Texture'SunriseHUD.Icons.Perk_Medic_Silver'
	 GoldIcon=Texture'SunriseHUD.Icons.Perk_Medic_Gold'
     OnHUDIcon=Texture'KillingFloorHUD.Perks.Perk_Medic'
     OnHUDGoldIcon=Texture'KillingFloor2HUD.Perk_Icons.Perk_Medic_Gold'
     VeterancyName="Field Medic"
     Requirements(0)="Heal %x HP on your teammates"
     SRLevelEffects(0)="120% faster Syringe recharge|50% more potent medical injections|Can carry 6 first aid kits|50% less damage from Bloat Bile|12% faster movement speed|40% larger MP7M Medic Gun clip|2x better Body Armor|50% discount on Medic Weapons and Body Armor"
     SRLevelEffects(1)="140% faster Syringe recharge|50% more potent medical injections|Can carry 7 first aid kits|60% less damage from Bloat Bile|14% faster movement speed|60% larger MP7M Medic Gun clip|2.5x better Body Armor|55% discount on Medic Weapons and Body Armor"
     SRLevelEffects(2)="160% faster Syringe recharge|50% more potent medical injections|Can carry 8 first aid kits|70% less damage from Bloat Bile|16% faster movement speed|80% larger MP7M Medic Gun clip|3x better Body Armor|60% discount on Medic Weapons and Body Armor"
     SRLevelEffects(3)="180% faster Syringe recharge|50% more potent medical injections|Can carry 9 first aid kits|75% less damage from Bloat Bile|18% faster movement speed|100% larger MP7M Medic Gun clip|3.5x better Body Armor|65% discount on Medic Weapons and Body Armor|Spawn with an MP5 Medic Gun and Body Armor"
     SRLevelEffects(4)="200% faster Syringe recharge|50% more potent medical injections|10% faster healing darts firing and using syringe|Can carry 10 first aid kits|75% less damage from Bloat Bile|20% faster movement speed|100% larger MP7M Medic Gun clip|4x better Body Armor|70% discount on Medic Weapons and Body Armor|Spawn with an MP5 Medic Gun and Body Armor"
     SRLevelEffects(5)="215% faster Syringe recharge|75% more potent medical injections|15% faster healing darts firing and using syringe|Can carry 11 first aid kits|80% less damage from Bloat Bile|24% faster movement speed|100% larger MP7M Medic Gun clip|6x better Body Armor|70% discount on Medic Weapons and Body Armor|Spawn with an MP5 Medic Gun and Body Armor"
     SRLevelEffects(6)="230% faster Syringe recharge|80% more potent medical injections|20% faster healing darts firing and using syringe|Can carry 12 first aid kits|80% less damage from Bloat Bile|26% faster movement speed|100% larger MP7M Medic Gun clip|8x better Body Armor|70% discount on Medic Weapons and Body Armor|Spawn with a Medic Shotgun, MP5 Medic Gun and Body Armor"
	 SRLevelEffects(7)="245% faster Syringe recharge|85% more potent medical injections|25% faster healing darts firing and using syringe|Can carry 13 first aid kits|88% less damage from Bloat Bile|28% faster movement speed|100% larger MP7M Medic Gun clip|12x better Body Armor|75% discount on Medic Weapons and Body Armor|Spawn with a Medic Shotgun, MP5 Medic Gun and Body Armor"
     SRLevelEffects(8)="260% faster Syringe recharge|90% more potent medical injections|30% faster healing darts firing and using syringe|Can carry 14 first aid kits|92% less damage from Bloat Bile|30% faster movement speed|100% larger MP7M Medic Gun clip|16x better Body Armor|75% discount on Medic Weapons and Body Armor|Spawn with a Medic Shotgun, MP5 Medic Gun and Body Armor"
     SRLevelEffects(9)="300% faster Syringe recharge|100% more potent medical injections|35% faster healing darts firing and using syringe|Can carry 15 first aid kits|95% less damage from Bloat Bile|30% faster movement speed|100% larger MP7M Medic Gun clip|20x better Body Armor|80% discount on Medic Weapons and Body Armor|Spawn with a Medic Shotgun, M7A3 Medic Gun and Body Armor"
     SRLevelEffects(10)="300% faster Syringe recharge|100% more potent medical injections|35% faster healing darts firing and using syringe|Can carry 15 first aid kits|95% less damage from Bloat Bile|30% faster movement speed|100% larger MP7M Medic Gun clip|20x better Body Armor|80% discount on Medic Weapons and Body Armor|Spawn with a Medic Shotgun, M7A3 Medic Gun and 200 armor|Elite abilities:|70% extra headshot damage with 9mm tactical|30% resistance to siren scream|Weapon Mastery - MP7 darts slow zeds"
}
